package com.practice.J2E.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * @author kayn
 * @date 2023/9/8 21:16
 **/
public class CollectionTest {

    public static void main(String[] args) {

        Map<Object, Object> hashMap = new HashMap<>();

        hashMap.put("A","1");

//        ArrayList<String> studentFrom1024List = new ArrayList<>();
//
//        studentFrom1024List.add("李娇");
//
//        studentFrom1024List.add("王惠");
//
//        studentFrom1024List.add("小黄");
//
//        studentFrom1024List.add("小吴");
//
//        studentFrom1024List.add("小吴");
//
//        System.out.println(studentFrom1024List);

        //下标
//        for(int i = 0;i<studentFrom1024List.size();i++) {
//
//            System.out.println(studentFrom1024List.get(i) + "吃饭饭");
//
//        }

        //增强for循环
//        for (String student : studentFrom1024List) {
//
//            System.out.println(student + "吃饭饭");
//
//        }






//        HashSet<String> studentFrom1024Set = new HashSet<>();
//
//        studentFrom1024Set.add("王惠");
//
//        studentFrom1024Set.add("小黄");
//
//        studentFrom1024Set.add("小吴");
//
//        studentFrom1024Set.add("李娇");
//
//        studentFrom1024List.add("小吴");
//
//        System.out.println(studentFrom1024Set);
//
//
//        for (String student : studentFrom1024Set) {
//
//            System.out.println(student + "吃饭饭");
//
//        }


        //key value
        HashMap<String,String> studentFrom1024Map = new HashMap<>();

        studentFrom1024Map.put("李娇","183");

        studentFrom1024Map.put("小黄","150");

        studentFrom1024Map.put("小吴","165");

        studentFrom1024Map.put("王惠","160");

        System.out.println(studentFrom1024Map);

//        String lj = studentFrom1024Map.get("李娇");

        for (String key : studentFrom1024Map.keySet()) {

            System.out.println(key + ":" + studentFrom1024Map.get(key));

        }

        for (Map.Entry<String, String> entry : studentFrom1024Map.entrySet()) {

            String key = entry.getKey();

            String value = entry.getValue();


        }


    }
}
